<%@page contentType="text/html; charset=utf-8" language="java" errorPage="error.jsp"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%
String subtitle = "找回密码";
String scripts = "/static/js/Validform_min.js";
String styles = "/static/css/validation.css?v=0.0.1";
%>
<%@ include file="/include/header.jspf"%>
<script>
$(document).ready(function() {
	
	$("#acountForm").Validform({
		btnSubmit:"#btn_sub",
		tiptype:function(msg,o,cssctl){
			if(o.obj){
					var objtip=o.obj.parent().parent().find(".Validform_checktip");
					cssctl(objtip,o.type);
					objtip.text(msg);
				}
		},
		tipSweep:false,
		postonce:true
	});
	

	$("#captcha_refresh,#captcha_img").click(function(){
		var o = $("#captcha_img");
		var ts = new Date().getTime();
		var src = o.attr("src");
		src = src.substr(0,src.indexOf("ts"));
		src += "ts="+ts;
		o.attr("src",src);
	});
});
</script>

<body>
  <div id="header" class="wraper">
  </div>
  <div id="bodier" class="wraper">
	<c:choose>
		<c:when test="${null==sessionScope.forgetPwUser}">    
		  <div>很遗憾 ：非法请求！！</div>
	   </c:when>
	   <c:when test="${null!=sessionScope.forgetPwUser && null==sessionScope.question}">    
		  <div>你没有设置安全问题，请联系系统管理员取回密码！</div>
	   </c:when>
	   <c:otherwise>  
			<form id="acountForm" action="/account/RetakePasswordByAnswer2.do" method="post">
				<div class="aline">
					<label>请回答问题：</label>
					<span>${sessionScope.question}</span>
				</div>

				<div class="aline">
					<label>答案：</label>
					<div>
						<input type="text" name="answer" datatype="s6-20" nullmsg="请输入正确的问题答案" errormsg="答案长度为4-40位"/>
					</div>
				<c:choose>
				   <c:when test="${null!=errors.answer}">    
					   <div class="Validform_checktip Validform_wrong">
							<c:forEach items="${errors.answer}" var="err">
								${err}
							</c:forEach>
						</div>
				   </c:when>
				   <c:otherwise>  
					<div class="Validform_checktip"></div>
				   </c:otherwise>
				</c:choose>
				</div>

				<div class="aline">
					<label>设置新密码：</label>
					<div>
						<input type="password" name="password" datatype="s6-20" nullmsg="请设置密码！" errormsg="密码长度为6-16位！"/>
					</div>
			<c:choose>
			   <c:when test="${null!=errors.password}">    
				   <div class="Validform_checktip Validform_wrong">
						<c:forEach items="${errors.password}" var="err">
							${err}
						</c:forEach>
					</div>
			   </c:when>
			   <c:otherwise>  
				<div class="Validform_checktip">密码长度为6-16位，可用英文字母、数字</div>
			   </c:otherwise>
			</c:choose>
					
				</div>
				<div class="aline">
					<label>重复新密码：</label>
					<div>
						<input type="password" name="confirmPassword" datatype="*" recheck="password" errormsg="两次新密码输入不一致"/>
					</div>
			<c:choose>
			   <c:when test="${null!=errors.confirmPassword}">    
				   <div class="Validform_checktip Validform_wrong">
						<c:forEach items="${errors.confirmPassword}" var="err">
							${err}
						</c:forEach>
					</div>
			   </c:when>
			   <c:otherwise>  
				<div class="Validform_checktip"></div>
			   </c:otherwise>
			</c:choose>
				</div>

				<div class="aline">	
					<label>验证码：</label>
					<div>
						<input type="text" name="captcha" datatype="s4-10" nullmsg="请输入图片验证码" errormsg="请输入图片验证码"/>
					<c:choose>
					   <c:when test="${null!=errors.captcha}">    
						   <div class="Validform_checktip Validform_wrong">
								<c:forEach items="${errors.captcha}" var="err">
									${err}
								</c:forEach>
							</div>
					   </c:when>
					   <c:otherwise>  
						<div class="Validform_checktip"></div>
					   </c:otherwise>
					</c:choose>
						<div>
							<img id="captcha_img" width="150px" height="60px" src="/captcha.jpg?token=1220102350236765748&ts=0" style="border:1px solid #ddd">
							<a id="captcha_refresh" href="#" title="看不清左边的字符">看不清？</a>
						</div>
					</div>
				</div>

				<div class="aline">
					<input id="btn_sub" name="_finish" type="submit" value="完成"/>
					<input name="token" type="hidden" value="1220102350236765748"/>
				</div>
			</form> 
	   </c:otherwise>
	</c:choose>
   </div>

<%@ include file="/include/footer.jspf"%>